﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyWPF.Interface
{
    public interface IUser
    {
        /// <summary>
        /// 新建数据库
        /// </summary>
        /// <param name="path">数据库存储路径，例如 D:/ </param>
        /// <param name="datasource">数据库名称</param>
        void CreateDataSource(string path, string datasource);

        /// <summary>
        /// 在sqlite数据库里新建一张表
        /// </summary>
        /// <param name="name">表名称</param>
        /// <param name="type">表列名，例如 id int,name nvarchar(50) </param>
        void CreateTable(string name, string type);

        /// <summary>
        /// 往表中存数据
        /// </summary>
        void WriteTable(string name, string password, string power, string remarks = "");

        /// <summary>
        /// 输入用户名和密码，返回用户权限等级，没找到就返回0
        /// </summary>
        /// <param name="User"></param>
        /// <param name="PassWord"></param>
        /// <returns></returns>
        int FindUser(string User, string password);

        /// <summary>
        /// 输入用户名，查询是否存在，返回用户权限等级
        /// </summary>
        /// <param name="User"></param>
        /// <returns></returns>
        int FindUser(string User);

        /// <summary>
        /// 输入用户名，返回备注
        /// </summary>
        /// <param name="User"></param>
        /// <returns></returns>
        string FindRemarks(string User);

        /// <summary>
        /// 输入用户名，返回错误
        /// </summary>
        /// <param name="User"></param>
        /// <returns></returns>
        string FindError(string User);

        /// <summary>
        /// 输入用户名，返回locktime
        /// </summary>
        /// <param name="User"></param>
        /// <returns></returns>
        string FindLockTime(string User);

        /// <summary>
        /// 输入用户名删除该用户
        /// </summary>
        /// <param name="User"></param>
        void DeleteUser(string User);

        /// <summary>
        /// 输入用户名和密码，删除了就返回true
        /// </summary>
        /// <param name="User"></param>
        /// <param name="PassWord"></param>
        /// <returns></returns>
        bool DeleteUser(string User, string password);
        /// <summary>
        /// 输入权限等级，返回不高于该等级的用户
        /// </summary>
        /// <param name="power"></param>
        /// <returns></returns>
        DataTable FindPowerUser(int power);


        void UpDate(string User, string value);


        void UpDate(string value);
    }
}
